/**
 * Created by jiangj01 on 15/12/11.
 */
define(function (require) {
    var Class = require('static_public/js/class.js');

    describe('static_public/js/class', function () {
        var Parent;

        beforeEach(function(){
            Parent = Class.extend({
                init: function (name) {
                    this._name = name || 'parent';
                },
                getName: function () {
                    return this._name;
                }
            });
        });

        it('_super in constructor', function () {
            var parent = new Parent();
            expect(parent.getName()).toEqual('parent');

            var Child = Parent.extend({
                /**
                 * @constructs
                 */
                init: function () {
                    this._super('child');
                }
            });

            var child = new Child();
            expect(child.getName()).toEqual('child');
        });

        it('_super in method', function () {
            var Child = Parent.extend({
                getName: function () {
                    return this._super() + '\'s child';
                }
            });

            var child = new Child();
            expect(child.getName()).toEqual('parent\'s child');
        });

        it('instanceof', function () {
            var Child = Parent.extend({});

            var child = new Child();
            expect(child instanceof Child).toEqual(true);
            expect(child instanceof Parent).toEqual(true);
        });
    });
});